package com.yyysj.friend.controller;

import com.yyysj.common.core.domain.Result;
import com.yyysj.friend.domain.dto.PostAddDTO;
import com.yyysj.friend.domain.vo.PostAddVO;
import com.yyysj.friend.domain.vo.PostListVO;
import com.yyysj.friend.service.IPostService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/posts")
public class PostController {

    private final IPostService postService;

    @GetMapping
    public Result<PostListVO> list() {
        return Result.ok(postService.list());
    }

    @PostMapping
    public Result<PostAddVO> add(@RequestBody PostAddDTO postAddDTO) {
        return Result.ok(postService.add(postAddDTO));
    }
}
